﻿<UserControl x:Class="XamlaApp.Views.ElementPropertyViews.TextBlockProperties"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:form="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
    xmlns:prop="clr-namespace:XamlaApp.Views.ElementPropertyViews"
    xmlns:Controls="clr-namespace:SilverlightContrib.Controls;assembly=SilverlightContrib.Controls">
    <StackPanel Background="White">
        <prop:FrameworkElementProperties></prop:FrameworkElementProperties>
        <form:DataForm CurrentItem="{Binding}">
            <form:DataForm.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="TextBlock Properties"></TextBlock>
                </DataTemplate>
            </form:DataForm.HeaderTemplate>
            <form:DataForm.EditTemplate>
                <DataTemplate>
                    <StackPanel>
                        <form:DataField>
                            <TextBox Text="{Binding Text, Mode=TwoWay}" TextChanged="TextBox_TextChanged"></TextBox>
                        </form:DataField>
                        <form:DataField>
                            <CheckBox IsChecked="{Binding Wrap, Converter={StaticResource WrapModeConverterResource}, Mode=TwoWay}"></CheckBox>
                        </form:DataField>
                        <form:DataField>
                            <TextBox Text="{Binding FontSize, Mode=TwoWay}"></TextBox>
                        </form:DataField>
                        <form:DataField>
                            <ComboBox SelectedIndex="{Binding Alignment, Converter={StaticResource TextAlignmentConverterResource}, Mode=TwoWay}">
                                <TextBlock Text="Left"></TextBlock>
                                <TextBlock Text="Center"></TextBlock>
                                <TextBlock Text="Right"></TextBlock>
                            </ComboBox>
                        </form:DataField>
                        <form:DataField>
                            <Grid>
                                <Button HorizontalContentAlignment="Left" Click="Button_Click" Tag="{Binding ElementName=popupColorPicker}">
                                    <Button.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <Rectangle Width="20" Height="20" Fill="{Binding ForegroundBrush}"></Rectangle>
                                            <TextBlock Margin="5,0,0,0" Text="Text Color..."></TextBlock>
                                        </StackPanel>
                                    </Button.Content>
                                </Button>
                                <Popup x:Name="popupColorPicker" >
                                    <Border BorderBrush="Black" BorderThickness="1">
                                        <StackPanel>
                                            <Controls:ColorPicker SelectedColorChanging="ColorPicker_SelectedFillColorChanging" SelectedColor="{Binding ForegroundBrush, Mode=TwoWay, Converter={StaticResource SolidColorBrushToColorConverterResource}}">
                                            </Controls:ColorPicker>
                                            <Button Content="Finished" Click="Button_Click" Tag="{Binding ElementName=popupColorPicker}"></Button>
                                        </StackPanel>
                                    </Border>
                                </Popup>
                            </Grid>
                        </form:DataField>
                    </StackPanel>
                </DataTemplate>
            </form:DataForm.EditTemplate>
        </form:DataForm>
    </StackPanel>
</UserControl>
